package com.api.mapper;

import com.api.pojo.Chamber;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ChamberMapper {

    @Select("select * from chamber where id = #{id}")
    Chamber getById(Integer id);

    @Insert("insert into chamber(bid, label) value(#{bid}, #{label})")
    void create(Integer bid, String label);

    @Delete("delete from chamber where id = #{id}")
    void remove(Integer id);

    @Update("update chamber set bid = #{bid}, label = #{label} where id = #{id}")
    void update(Integer id, Integer bid, String label);

    @Select("select * from chamber limit #{pageNo},#{pageSize}")
    List<Chamber> get(Integer pageNo, Integer pageSize);

    @Select("select count(*) from chamber")
    Integer count();

    @Select("select * from chamber where bid = #{bid} limit #{pageNo},#{pageSize}")
    List<Chamber> getByBid(Integer bid, Integer pageNo, Integer pageSize);

    @Select("select count(*) from chamber where bid = #{bid}")
    Integer countByBid(Integer bid);

    @Select("select * from chamber where bid = #{bid}")
    List<Chamber> getAll(Integer bid);

}
